package com.wedata.腾讯;

import cn.hutool.core.date.DateUtil;
import cn.hutool.json.JSONObject;
import com.wedata.HttpUtils;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

public class 企业微信统计 {

    public static void main(String[] args) {
        get_user_behavior_data();
    }


    /**
     * 获取「联系客户统计」数据
     */
    public static void get_user_behavior_data(){
        Map<String,Object> map = new HashMap<>();
        //map.put("userid","TanRong");
        map.put("partyid",3);

        Date sdate = DateUtil.parse("2024-07-07");
        Date edate = DateUtil.parse("2024-07-08");
        map.put("start_time", sdate.getTime()/1000);
        map.put("end_time",edate.getTime()/1000);
        JSONObject String = HttpUtils.sendPost("https://qyapi.weixin.qq.com/cgi-bin/externalcontact/get_user_behavior_data?access_token="+企业微信.postRequestWithSign(),null,new JSONObject(map));
        System.out.println(String);
        //{"errcode":0,"errmsg":"ok","behavior_data":[{"negative_feedback_cnt":16,"avg_reply_time":219,"new_apply_cnt":0,"message_cnt":596,"chat_cnt":116,"reply_percentage":84,"new_contact_cnt":56,"stat_time":1720281600},{"negative_feedback_cnt":11,"avg_reply_time":80,"new_apply_cnt":0,"message_cnt":466,"chat_cnt":106,"reply_percentage":84,"new_contact_cnt":35,"stat_time":1720368000}]}
    }

}
